﻿using BasicInformation.Domain;
using BasicInformation.Infrastructure.Interface;
using BasicInformation.ReadAPI.Application.Command.OutsourcingCommand;
using MediatR;

namespace BasicInformation.ReadAPI.Application.CommandHandler.OutsourcingCommandHandler
{
    public class OutsourcingInfoCommandHandler : IRequestHandler<OutsourcingInfoCommand, Outsourcing>
    {
        private readonly IOutsourcingRepository outsourcingRepository;

        public OutsourcingInfoCommandHandler(IOutsourcingRepository outsourcingRepository)
        {
            this.outsourcingRepository = outsourcingRepository;
        }

        public async Task<Outsourcing> Handle(OutsourcingInfoCommand request, CancellationToken cancellationToken)
        {
            var info = await outsourcingRepository.Get(request.Id);
            return info;
        }
    }
}
